/*
 * Copyright 2019-2025 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * https://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.iiifi.kite.jdbc.model;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 基础model
 *
 * @author kite@iiifi.com 花朝
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "数据模型")
public abstract class BaseModel<T extends Model<?>> extends Model<T> implements Serializable {

    @TableId
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "主键", example = "6038370049666058595")
    protected Long id;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间", example = "2018-08-18 08:08:08")
    protected LocalDateTime createdAt;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建者", example = "6038370049666058595")
    protected String createdBy;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间", example = "2018-08-18 08:08:08")
    protected LocalDateTime updatedAt;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新者", example = "6038370049666058595")
    protected String updatedBy;

    @JsonIgnore
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "是否删除[0:否,1:是]", example = "0")
    public Boolean isDeleted;
}
